OCRGetTextFromFile

Returns the text found using OCR in an image file. Use when debugging OCR statements.

For example, if you use the SaveRegionToImageFile statement to make sure the correct region of an application is read using OCR, you can use this statement to check the text returned from the saved image and determine if changes are needed in the OCR playback options. See Troubleshooting OCR issues.

Syntax

OCRGetTextFromFile("FilePath", LeftEdgePixel, RightEdgePixel, RectangleWidth, RectangleHeight)

Arguments

Argument Description
FilePath Full path to the image file to return text from. The following file types are supported: BMP, EXIF, GIF, JPG, PNG, and TIFF.
LeftEdgePixel Optional integer pixel value of the left side of the rectangle that contains the text to return. If not specified, all text in the image is returned. Required if the TopEdgePixel, RectangleWidth, or RectangleHeight argument is specified.
TopEdgePixel Optional integer pixel value of the top side of the rectangle that contains the text to return. If not specified, all text in the image is returned. Required if the LeftEdgePixel, RectangleWidth, or RectangleHeight argument is specified.
RectangleWidth Optional integer pixel value of the width of the rectangle that contains the text to return. If not specified, all text in the image is returned. Required if the LeftEdgePixel, TopEdgePixel, or RectangleHeight argument is specified.
RectangleHeight Optional integer pixel value of the height of the rectangle that contains the text to verify. If not specified, all text in the image is returned. Required if the LeftEdgePixel, TopEdgePixel, or RectangleWidth argument is specified.

Return value

Value Description
Value Text found in the file.

Example

ocrText = OCRGetTextFromFile("C:\\OCRTests\\Images\\DebugPassword.png")

PrintLn("Text in screenshot: " + ocrText)